package com.cv.platform.api.subscribe;

import cn.hutool.core.util.ObjUtil;
import com.cv.platform.service.subscribe.CvSubscribeService;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * 订阅 API 接口实现类
 *
 * @author Charles_XDXD
 */
@DubboService
public class SubscribeApiImpl implements SubscribeApi {

    @Resource
    private CvSubscribeService cvSubscribeService;

    @Override
    public Integer getFansCount(Long userId) {
        Integer fansCount = cvSubscribeService.getFansCount(userId);
        if (ObjUtil.isEmpty(fansCount)) {
            return 0;
        }
        return fansCount;
    }

    @Override
    public Integer getFollowCount(Long userId) {
        Integer followCount = cvSubscribeService.getFollowCount(userId);
        if (ObjUtil.isEmpty(followCount)) {
            return 0;
        }
        return followCount;
    }

    @Override
    public void deleteAllSubscribe(Long userId) {
        cvSubscribeService.deleteAllSubscribe(userId);
    }
}
